<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js">
    
    </script>
</head>

<body>
    <div id="app">
        <!-- v-model绑定 -->
        <div>
            <label for="user">用户名</label>
            <input type="text" id="user" v-model="user">
                {{user}}
        </div>
        <!-- 不用v-model绑定 -->
        <div>
            <label for="age">年龄</label>
            <input type="text" @input="ages" ref="reference" :value='age' id="age">
            {{age}}
        </div>
        <!-- v-model绑定 -->
        <div>
            <label for="check">全选</label>
            <input type="checkbox"  v-model="check">
            {{check}}
        </div>
        <!-- 不用v-model绑定 -->
        <div>
            <label for="user">全选</label>
            <input type="checkbox" :checked='quan' @change='acsasc($event)'>
            {{quan}}
        </div>
        <div>
            <input type="text"  v-model.trim.number.lazy="s">
            {{s}} --{{s.length}} -- {{typeof s }}
        </div>
    </div>
    <script>
        new Vue({
            el:'#app',
            data() {
                return {
                    user:'addas',
                    age:18,
                    check:false,
                    quan:false,
                    s:""
                }
            },
            methods:{
                ages(e){
                    // this.age=document.getElementById('age').value
                    this.age=this.$refs.reference.value
                    // this.age=e.target.value
                },
                acsasc(e){
                    console.log(e.target.checked);
                    this.quan=e.target.checked
                }
            }
        })
    </script>
</body>

</html>